package com.example.demo20230927;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PACKAGE_NAME: com.example.demo20230927
 * @NAME: HelloController
 * @USER: jiang000
 * @DATE: 2023/12/1
 **/
@RestController
public class HelloController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping("/redis")
    public String testRedis() {
        redisTemplate.opsForValue().set("testKey", "123");
        return redisTemplate.opsForValue().get("testKey");
    }
    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }
}
